package com.example.yiqiuser.controller;


import com.example.yiqiuser.entity.TDicGchannel;
import com.example.yiqiuser.service.TDicGchannelService;
import com.example.yiqiuser.util.Page;
import com.example.yiqiuser.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 攻略栏目(TDicGchannel)表控制层
 *
 * @author makejava
 * @since 2023-04-03 10:51:52
 */
@RestController
@RequestMapping("tdg")
public class TDicGchannelController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private TDicGchannelService tDicGchannelService;

    @RequestMapping("query")
    public Result queryPage(@RequestBody Page<TDicGchannel> page) {
        return success(tDicGchannelService.queryPage(page));
    }

    @GetMapping("queryAll")
    public Result queryAll() {
        return success(tDicGchannelService.queryAll());
    }

    @GetMapping("queryById")
    public Result queryById(@RequestBody Integer code) {
        return success(tDicGchannelService.queryById(code));
    }

    @PostMapping("add")
    public Result add(@RequestBody TDicGchannel tDicGchannel) {
        return success(tDicGchannelService.insert(tDicGchannel));
    }

    @PostMapping("update")
    public Result update(@RequestBody TDicGchannel tDicGchannel) {
        return success(tDicGchannelService.update(tDicGchannel));
    }

    @DeleteMapping("delete")
    public Result deleteById(int code) {
        return success(tDicGchannelService.deleteById(code));
    }


}

